<?php
/* @var $this SiteController */
/* @var $model LoginForm */
/* @var $form CActiveForm */

$this->pageTitle = Yii::app()->name . ' - 登陆';
$this->breadcrumbs = array(
    'Login',
);
?>
<div class="lock-wrapper">
    <div class="lock-box text-center" id="userLogin" style="display: ">
         
        <div style="clear: both;"></div>
        <div class="form login " style="padding-bottom: 14px;">
            <?php $form = $this->beginWidget('CActiveForm', array(
                'id' => 'login-form',
                'enableClientValidation' => true,
                'clientOptions' => array(
                    'validateOnSubmit' => true,
                ),
                'htmlOptions' => array('class' => 'form-inline', "onkeydown" => "if(event.keyCode==13) return $('.btn-submit').click();"),
            )); ?>
            <input type="hidden" value="<?php echo Yii::app()->request->urlReferrer; ?>" id="back_url" name="back_url">
            <div class="form-group">
                <?php echo $form->error($model, 'username'); ?>
                <?php echo $form->error($model, 'password'); ?>
                <?php echo $form->error($model, 'verifyCode'); ?>

            </div>
            <div class="form-group col-lg-12 width100">
                <div class="row form-group">
                    <?php echo $form->textField($model, 'username', array('placeholder' => '用户名', 'class' => 'form-control lock-input')); ?>
                </div>
                <div class="row form-group">
                    <?php echo $form->passwordField($model, 'password', array('placeholder' => '密码', 'class' => 'form-control lock-input')); ?>
                </div>
                <div class="row form-group" id="loginCaptcha" class="row form-group" >
                    <?php echo $form->textField($model, 'verifyCode', array('placeholder' => '验证码', 'class' => 'form-control lock-input width40')); ?>
                    <?php $this->widget('CCaptcha', array(
                        'clickableImage' => true,
                        'showRefreshButton' => false,
                        'imageOptions' => array('class' => "loginCaptcha", 'alt' => '点击刷新验证码', 'title' => '点击刷新验证码', 'style' => 'cursor:pointer',)
                    )); ?>
                </div>

                <button class="btn btn-lock btn-submit" type="button"><i class="icon-arrow-right"></i></button>
                <div style="clear:both;"></div>
            </div>

            <?php $this->endWidget(); ?>
        </div>
        <div style="font-size:16px;"><?php if($_SERVER['SERVER_PORT'] != 80){echo 'v '.Yii::app()->params['version'].' TEST';}else{echo 'v '.Yii::app()->params['version'];}?>
        </div>
    </div>
   
    <script language="JavaScript">
        var t;
        $(function () {
            $.loading.hide();
            $(".btn-submit").click(function () {
                $.loading.show();
                if (($("#LoginForm_username").val() == "") ) {
                    $("#LoginForm_username_em_").attr("style","color: red; display:;");
                    $("#LoginForm_username_em_").html("用户名或密码不能为空");
                    $.loading.hide();
                     return false;
                }
                if (($("#LoginForm_password").val() == "") ) {
                    $("#LoginForm_password_em_").attr("style","color: red; display:;");
                    $("#LoginForm_password_em_").html("用户名或密码不能为空");
                    $.loading.hide();
                    return false;
                }
                 
                $("#login-form").submit();
            });
             
        });
       
        $(document).ready(function () {
            $(".lock-screen").css("background", "#02bac6 url('<?php echo $login_back_img;?>')");
            $(".lock-screen").css("background-size", "100% auto");
        })
    </script>

